/**
 * Created by zhangqingxi on 2017-04-06.
 */
var modelPath = ROOT_PATH + '/emergency/storagePoint/';




//初始化负责人
function initUser() {
    $("#chargePersonName").textbox({
        editable:false,
        required: true,
        iconWidth: 22,
        icons: [{
            iconCls: 'icon-add',
            handler: function (e) {
                add_userInfo_func();
            }
        }, {
            iconCls: 'icon-remove',
            handler: function (e) {
                $(e.data.target).textbox('clear');
                $('#chargePersonId').val('');

            }
        }]
    });
}
function add_userInfo_func() {
    WindowManager.openLayer({
        type: 2,
        title: '选择人员信息',
        area: ['1150px', '70%'],
        content: ROOT_PATH + '/permission/user/simpleList.shtml?isMulti=0',
        callBack: function (data) {//窗口关闭后的回调函数
            var id = data[0].id;
            var name = data[0].realName;

            $('#chargePersonId').val(id);
            $('#chargePersonName').textbox('setValue', name);

        }
    });

}
//初始化部门
function initDept() {

    $('#deptId').combotree({
        url: findDept,
        required:true,
        editable:false,
        prompt:'请选择'
    });
}
//存放点类型
function initType() {

    $('#typeId').combobox({
        url: dictionaryByCode + storagePointType,
        prompt: '请选择',
        required: true,
        editable: false,
        valueField: 'id',
        textField: 'text'
    });
}
//存放点类型
function initReserveClassification() {

    $('#reserveClassificationId').combobox({
        url: dictionaryByCode + reserveClassification,
        prompt: '请选择',
        required: true,
        editable: false,
        valueField: 'id',
        textField: 'text'
    });
}
//初始化风险区域
function initManagementArea() {
    $("#managementAreaName").textbox({
        editable:false,
        required: true,
        iconWidth: 22,
        icons: [{
            iconCls: 'icon-add',
            handler: function (e) {
                add__managementArea_func();
            }
        }, {
            iconCls: 'icon-remove',
            handler: function (e) {
                $(e.data.target).textbox('clear');
                $('#managementAreaId').val('');

            }
        }]
    });
}
function add__managementArea_func(){
    WindowManager.openLayer({
        type: 2,
        title: '选择风险区域',
        area: ['1150px', '70%'],
        content: ROOT_PATH + '/risk/region/simpleList.shtml',
        callBack:function(data){//窗口关闭后的回调函数
            var id=data.id;
            var name=data.name;
            $('#managementAreaId').val(id);
            $('#managementAreaName').textbox('setValue', name);
        }
    });
}